<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn">点击事件</button>
    
    <script>
        // 获取按钮元素
        var btn = document.querySelector('.btn');
        
        // 绑定点击事件
        btn.addEventListener('click', function() {
            alert('按钮被点击了');
            });
    </script>
</body>
</html>